package io.summer.basis.log;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.CollectionUtils;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.Collection;

/**
 * @author Moonlight
 */
@Configuration
@Slf4j
@ConfigurationProperties(prefix = "summer.basis.log")
@Data
public class LogFilterProperties {
  @PostConstruct
  private void init() {
    if (CollectionUtils.isEmpty(includePattern)) {
      includePattern = new ArrayList<>();
      includePattern.add("/*");
    }
  }

  private boolean enable = true;
  private String separator = "\n";
  private LogFilter.LogType logType = LogFilter.LogType.NONE;
  private int maxBodySize = 1024;
  private Collection<String> includePattern;
}


